{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "900d286c",
   "metadata": {},
   "source": [
    "# datetime\n",
    "    > date\n",
    "    > time\n",
    "    > datetime\n",
    "    > timedelta"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ca1d0a18",
   "metadata": {},
   "source": [
    "## datetime.date\n",
    "1. date"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "daa18b53",
   "metadata": {},
   "source": [
    "## datetime.time\n",
    "1. component\n",
    "    > hour <br>\n",
    "    > minute <br>\n",
    "    > second <br>\n",
    "    > microsecond <br>\n",
    "    > tzinfo <br>\n",
    "2. datetime.time.max()\n",
    "3. datetime.time.min()\n",
    "4. datetime.time.resolution()\n",
    "5. datetime.time.\\_\\_format\\_\\_(\"%H:%M:%S\") = datetime.time.strftime(\"%H:%M:%S\")\n",
    "6. datetime.\\_\\_str\\_\\_() = datetime.time.isoformat()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8e2efd0d",
   "metadata": {},
   "source": [
    "## datetime.datetime\n",
    "1. component\n",
    "    > year <br>\n",
    "    > month <br>\n",
    "    > day <br>\n",
    "    > hour <br>\n",
    "    > minute <br>\n",
    "    > second <br>\n",
    "    > microsecond <br>\n",
    "    > txinfo <br>\n",
    "2. datetime.datetime.now()\n",
    "3. datetime.datetime.utcnow()\n",
    "3. datetime.datetime.time()\n",
    "4. datetime.datetime.utctimetuple()\n",
    "5. datetime.datetime.combine(date, time)\n",
    "6. datetime.datetime.strptime('2017-3-22 15:25','%Y-%m-%d %H:%M%S\")\n",
    "7. datetime.datetim.utcfromtimestamp(time.time())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "082001b4",
   "metadata": {},
   "source": [
    "## timedelta\n",
    "1. component\n",
    "    > days <br>\n",
    "    > hours <br>\n",
    "    > minutes <br>\n",
    "    > seconds <br>\n",
    "    > microseconds <br>\n",
    "    > milliseconds <br>\n",
    "    > weeks <br>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ab9448b9",
   "metadata": {},
   "source": [
    "# practice\n",
    "## time difference"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "4d42610a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "import time\n",
    "\n",
    "start_time = datetime.now()\n",
    "time.sleep(5)\n",
    "end_time = datetime.now()\n",
    "delta = end_time - start_time\n",
    "delta.seconds"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f1e2c179",
   "metadata": {},
   "source": [
    "## time calculation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "fbf485dc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2023-11-25 19:30:00\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "from datetime import timedelta\n",
    "from datetime import date\n",
    "\n",
    "now = datetime.fromisoformat(\"2023-11-22,19:30:00\")\n",
    "delta_1 = timedelta(hours=72)\n",
    "then = now + delta_1\n",
    "print(then)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "eaee3382",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
